package com.moniteach.server.db.bo;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import org.json.JSONObject;

import com.moniteach.utils.Resource;

@PersistenceCapable
public class UserGroup {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;

	@Persistent
	private Long user;

	@Persistent
	private Long group;

	@Persistent
	private Boolean visibility;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getUser() {
		return user;
	}

	public void setUser(Long user) {
		this.user = user;
	}

	public Long getGroup() {
		return group;
	}

	public void setGroup(Long group) {
		this.group = group;
	}

	public Boolean getVisibility() {
		return visibility;
	}

	public void setVisibility(Boolean visibility) {
		this.visibility = visibility;
	}

	public UserGroup(Long user, Long group, Boolean visibility) {
		super();
		this.user = user;
		this.group = group;
		this.visibility = visibility;
	}

	public JSONObject toJSONObject() {
		JSONObject jo = new JSONObject();
		jo.put(Resource.Const.user, user);
		jo.put(Resource.Const.group, group);
		jo.put(Resource.Const.visibility, visibility);
		return jo;
	}
}